import QtQuick 2.11

import "."
import "_Global"
import "_Global/Button"

import "_Global/Global.js" as GlobalJS
import "GameJS.js" as GameJS

Item {
    signal s_ChoiceServer(int gameServerID)    //ServerID!!

    function showGameServerInfo() {
        console.debug("游戏服务器信息:")
        for(var v in GameManager.userInfo.gameServerInfoMap) {
            console.debug(v,":",GameManager.userInfo.gameServerInfoMap[v].name)
        }
        console.debug("-----------")
    }

    function setServerButtons(enable) {
        buttonBeiJing.enabled = enable;
        buttonFuDan.enabled = enable;
    }

    //width: 600
    //height: 400
    id: root
    anchors.fill: parent

    Rectangle {
        id: background
        anchors.fill: parent

        Image { //背景
            id: backImage
            source: Global.resource.images.gameServer.back
            anchors.fill: parent
        }


        ImageButton2 {
            id: buttonBeiJing
            x: Global.gamePos.mapChoiceServer.rectServer1.x
            y: Global.gamePos.mapChoiceServer.rectServer1.y
            width: Global.gamePos.mapChoiceServer.rectServer1.width
            height: Global.gamePos.mapChoiceServer.rectServer1.height
            source: Global._FixResourcePath_R("Media/Images/GameServers/BeiJing.png")

            soundEffectClick: Global.resource.effects.effectButton
            bEffectOn: Global.config.bEffectOn

            onButtonClicked: {
                onClicked: s_ChoiceServer(1);
            }
        }

        ImageButton2 {
            id: buttonFuDan
            x: Global.gamePos.mapChoiceServer.rectServer2.x
            y: Global.gamePos.mapChoiceServer.rectServer2.y
            width: Global.gamePos.mapChoiceServer.rectServer2.width
            height: Global.gamePos.mapChoiceServer.rectServer2.height
            source: Global._FixResourcePath_R("Media/Images/GameServers/FuDan.png")

            soundEffectClick: Global.resource.effects.effectButton
            bEffectOn: Global.config.bEffectOn

            onButtonClicked: {
                onClicked: s_ChoiceServer(2)
            }
        }

        ColorButton {
            x: 0
            y: 0
            width: Global.gamePos.mapChoiceServer.rectServer2.width
            height: Global.gamePos.mapChoiceServer.rectServer2.height
            visible: GameManager.platform == "debug" ? true : false

            Text {
                text: qsTr("测试服务器_最新")
            }

            onButtonClicked: {
                onClicked: s_ChoiceServer(3)
            }
        }


        /*
        Rectangle {
            id: rectangle
            x: 48
            y: 40
            width: 91
            height: 120
            gradient: Gradient {
                GradientStop {
                    position: 0
                    color: "#ffffff"
                }

                GradientStop {
                    position: 1
                    color: "#000000"
                }
            }

            Text {
                id: text1
                x: 22
                y: 54
                text: qsTr("测试服务器")
                font.pixelSize: 12
            }

            MouseArea {
                id: mouseArea
                anchors.fill: parent
                onClicked: s_ChoiceServer(0)
            }
        }
        */
    }



    Component.onCompleted: {
    }

}
